<html>
<head><meta charset="utf-8"><title>Compiler Test Placement · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compiler.20Test.20Placement.html">Compiler Test Placement</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="224270247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compiler%20Test%20Placement/near/224270247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> asquared31415 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compiler.20Test.20Placement.html#224270247">(Jan 28 2021 at 00:41)</a>:</h4>
<p>I am working on fixing <a href="https://github.com/rust-lang/rust/issues/74262">https://github.com/rust-lang/rust/issues/74262</a> and I have an implementation working, however I would like some help figuring out where to put my test.  The test used is nearly identical to the snippet posted in that issue.  The test simply needs to compile (though it could run as well if that's easier) and I don't know where to place it for best organization.  The <code>assembly</code> tests seem to be more related to making sure that Rust code emits specific assembly.  <code>codegen</code> might work, but I'm not sure that I need to inspect the assembly, or make sure about optimizations, I simply need to confirm that the code compiles.<br>
If it matters for the purposes of test changes, the changes are all in <code>rustc_codegen_llvm/asm.rs</code></p>



<a name="224270576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compiler%20Test%20Placement/near/224270576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compiler.20Test.20Placement.html#224270576">(Jan 28 2021 at 00:45)</a>:</h4>
<p>I was just looking through this recently: <a href="https://rustc-dev-guide.rust-lang.org/tests/intro.html">https://rustc-dev-guide.rust-lang.org/tests/intro.html</a></p>



<a name="224270702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compiler%20Test%20Placement/near/224270702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compiler.20Test.20Placement.html#224270702">(Jan 28 2021 at 00:47)</a>:</h4>
<p>seems like <code>src/test/codegen/</code>might be the right place</p>



<a name="224270836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compiler%20Test%20Placement/near/224270836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compiler.20Test.20Placement.html#224270836">(Jan 28 2021 at 00:48)</a>:</h4>
<p>or maybe <code>/assembly/auxilary</code></p>



<a name="224270989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compiler%20Test%20Placement/near/224270989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compiler.20Test.20Placement.html#224270989">(Jan 28 2021 at 00:50)</a>:</h4>
<p>depends what the test looks like I guess</p>



<a name="224271407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compiler%20Test%20Placement/near/224271407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compiler.20Test.20Placement.html#224271407">(Jan 28 2021 at 00:55)</a>:</h4>
<p>I think src/test/ui/asm with a build-pass annotation is likely the right place. You probably don't need to check <em>what</em> is emitted, so codegen/assembly tests shouldn't be necessary</p>



<a name="224271426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compiler%20Test%20Placement/near/224271426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> asquared31415 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compiler.20Test.20Placement.html#224271426">(Jan 28 2021 at 00:56)</a>:</h4>
<p>The test is this, nearly identical to the example code provided in that issue:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#![feature(asm)]</span><span class="w"></span>

<span class="cp">#[inline(always)]</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">asm</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">unsafe</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="fm">asm!</span><span class="p">(</span><span class="s">"duplabel: nop"</span><span class="p">,);</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">asm</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="n">asm</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>I think auxilary is more for additional files, common utilities, etc, so I do not think this test is a good idea to go there.</p>



<a name="224271618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compiler%20Test%20Placement/near/224271618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compiler.20Test.20Placement.html#224271618">(Jan 28 2021 at 00:58)</a>:</h4>
<p>from the docs: 'ui – tests that check the exact stdout/stderr from compilation and/or running the test'</p>



<a name="224271788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compiler%20Test%20Placement/near/224271788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> asquared31415 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compiler.20Test.20Placement.html#224271788">(Jan 28 2021 at 01:00)</a>:</h4>
<p>I guess this kinda checks that the compilation succeeds rather than prints some error and crashes, which is what it was previously doing.  I think I like <code>ui/asm</code> since it's next to other tests that use <code>asm!</code>, but I really don't have strong feelings for any location in particular.</p>



<a name="224271846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compiler%20Test%20Placement/near/224271846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compiler.20Test.20Placement.html#224271846">(Jan 28 2021 at 01:01)</a>:</h4>
<p>yeah that seems like the best answer to me as well based on what you've described</p>



<a name="224271861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compiler%20Test%20Placement/near/224271861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compiler.20Test.20Placement.html#224271861">(Jan 28 2021 at 01:01)</a>:</h4>
<p>UI tests are the right place, I can say with high confidence.</p>



<a name="224271935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compiler%20Test%20Placement/near/224271935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compiler.20Test.20Placement.html#224271935">(Jan 28 2021 at 01:02)</a>:</h4>
<p>what does UI stand for <code>user interface</code>?</p>



<a name="224272098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compiler%20Test%20Placement/near/224272098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> asquared31415 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compiler.20Test.20Placement.html#224272098">(Jan 28 2021 at 01:04)</a>:</h4>
<p><code>ui/asm</code> sounds good, thanks for the help!</p>



<a name="224318554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compiler%20Test%20Placement/near/224318554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compiler.20Test.20Placement.html#224318554">(Jan 28 2021 at 12:25)</a>:</h4>
<p>We used to have categories like compile-pass and run-pass etc. They've been merged into and replaced by the ui test suite, so yeah that's the right place</p>



<a name="225998715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Compiler%20Test%20Placement/near/225998715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Compiler.20Test.20Placement.html#225998715">(Feb 11 2021 at 14:32)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281739">oliver</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/Compiler.20Test.20Placement/near/224271935">said</a>:</p>
<blockquote>
<p>what does UI stand for <code>user interface</code>?</p>
</blockquote>
<p>yes, "user interface", because historically the tests under <code>test/ui</code> were especially focused on the diagnostic output. The tests in (most of) the other directories didn't have support for checking the diagnostic output.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>